package com.elaine.wxapi.wxpublic;

import com.elaine.redis.RedisService;
import com.elaine.utils.HttpUtils;
import com.elaine.wxapi.wxpublic.response.WxApiResult;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

/**
 * @author wrb
 * @date 2020/4/1 10:13
 */
public class AccessTokenApi {

	private static final String GET_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";

	public static WxApiResult getToken(String appid,String secret) {
		String url = GET_TOKEN_URL.replace("APPID", appid).replace("APPSECRET", secret);
		String jsonStr = HttpUtils.requestGet(url, null, null);
		return new WxApiResult(jsonStr);
	}
}
